package com.server.rule.component;

import java.util.List;
/**
 * Classe abtraite correspondant à un noeud de l'arbre de decision 
 * @author queyroi
 *
 */
abstract class AbstractRuleComposite extends RuleComponent{
	
	protected List<RuleComponent> nextRules;
	
	@Override
	public boolean hasDecision() {
		boolean b=true;
		if(nextRules.isEmpty()) b=false;
		for(RuleComponent r : nextRules){
			if(!r.hasDecision()) b=false;
		}
		return b;		
	}

	/**
	 * @return the nextRules
	 */
	public List<RuleComponent> getChild() {
		return nextRules;
	}
	
	/**
	 * @param nextRules the nextRules to set
	 */
	public void setNextRules(List<RuleComponent> nextRules) {
		this.nextRules = nextRules;
	}
	
	public void add(RuleComponent ruleComponent){
		this.nextRules.add(ruleComponent);
	}
	
	public void remove(RuleComponent ruleComponent){
		this.nextRules.remove(ruleComponent);
	}
	
	public void clear(){
		this.nextRules.clear();
	}
	
	public abstract void getUsedVar(List<String> listeUsedVar);

}
